<template>
  <div class="banner">
    <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
      <van-swipe-item v-for="banner in bannerdata" :key="banner.id" ><img class="bimg" :src="banner.img" alt=""></van-swipe-item>
    </van-swipe>
  </div>
</template>

<script>

export default{
    name:'Banner',
    data(){
        return{
            banners:[]
        };
    }, 
    
    created(){
      //触发actions 第二个参数会传递到actions的payload
      // console.log(this.$store.dispatch("LINK_BANNER_DATA","/bannerTv"))
      this.$store.dispatch("LINK_BANNER_DATA","/home/banner")
      // console.log(this.banners)
    },
    computed:{
      bannerdata(){
        return this.$store.state.BannerM.banner
      }
      
      // console.log(this.banners)
    }
}
</script>

<style scoped>
.banner {
  width: 3.84rem;
  height: 1.92rem;
  /* background-color: rgb(197, 251, 255); */
  border-radius: .1rem;
  margin: 0 0.15rem;
}

.banner .bimg {
  width: 3.84rem;
  height: 1.92rem;
  border-radius: .1rem;

}
.my-swipe .van-swipe-item {
  color: #fff;
  height: 1.92rem;
  text-align: center;
  /* background-color: #39a9ed; */
}
.bimg{
  height: 1rem;
}
</style>
